import { fileURLToPath, URL } from "url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueJsx()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  server: {
    proxy: {
      "/api": {
        // target: "http://175.24.189.179:8080/",
        target: "http://localhost:8080/",
      },
      "/img":{
        // target: "http://175.24.189.179:8080/",
        target: "http://localhost:8080/",
      },
      "/barcode":{
        // target: "http://175.24.189.179:8080/",
        target: "http://localhost:8080/",
      },
      "/myqcloud": {
        target: "https://service-osj3eufj-1255468759.ap-shanghai.apigateway.myqcloud.com",
        changeOrigin: true,
        rewrite: path => path.replace(/^\/myqcloud/, ''),
      },
    },
  },
});
